<script lang="ts" setup>
import { Bell, ArrowDown, Lock, User, Operation, Message } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router';
const router = useRouter();
const list = [{},]

const toLogin = () => {
  router.push('/login')
}
</script>

<template>
  <div class="right">
    <el-icon class="bell">
      <Bell />
    </el-icon>

    <!-- <el-dropdown trigger="click"> -->
    <el-dropdown>
      <span class="el-dropdown-link">
        <div class="user">
          <img src="../../assets/avatar.png" alt="">
          <span class="nackname">给你奶儿瓶偷了</span>
        </div>
        <el-icon class="arrowdown">
          <ArrowDown />
        </el-icon>
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item><el-icon>
              <Lock />
            </el-icon> 修改密码 </el-dropdown-item>
          <el-dropdown-item><el-icon>
              <Message />
            </el-icon> 编辑信息 </el-dropdown-item>
          <el-dropdown-item><el-icon>
              <Operation />
            </el-icon> 更多设置 </el-dropdown-item>
          <el-dropdown-item divided @click="toLogin"><el-icon>
              <User />
            </el-icon> 退出登录 </el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<style lang="scss" scoped>
.el-dropdown-link {
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: .5s;

  &:hover {
    color: #7b7bec;
  }

  &:focus-visible {
    outline: none;
    outline: none;
  }
}

.right {
  display: flex;
  align-items: center;

  &>* {
    padding-right: 10px;
  }

  &>:last-child {
    padding-right: 0px;
  }
}

.bell {
  font-size: 25px;
  color: grey;
  cursor: pointer;

  &:hover {
    color: #7b7bec;
    animation: .2s shake infinite;
  }

  @keyframes shake {
    0% {
      transform: rotate(-15deg);
    }

    50% {
      transform: rotate(15deg);
    }

    100% {
      transform: rotate(0deg);
    }
  }
}

.user {
  display: flex;
  align-items: center;
  cursor: pointer;

  &>* {
    margin-right: 5px;
  }

  img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }

  .nackname {
    color: inherit;
    font-size: 16px;
    font-weight: 100;
  }
}
</style>